"""
31 - Dars Mavzu: Modul
"""
import random
from datetime import date, datetime, timedelta
# import locale

# date
TODAY = date.TODAY()
print(TODAY) # 2019-07-10
print(TODAY.day) # 10
print(TODAY.month) # 7
print(TODAY.year) # 2019
print(TODAY.weekday()) # 2019

# datetime
NOW1 = datetime.now()
NOW2 = datetime.today()

print(NOW1) # 2019-07-10 14:16:51.696373
print(NOW1.day) # 10
print(NOW1.month) # 7
print(NOW1.year) # 2019
print(NOW1.weekday()) # 2
print(NOW1.hour) # 14
print(NOW1.minute) # 16
print(NOW1.second) # 51

DAYS = ['Du', 'Se', 'Chor', 'Pay', 'Ju', 'Sh', 'Yak']
print(DAYS[NOW1.weekday()]) # ср

# locale.setlocale(locale.LC_ALL, 'ru_RU.UTF-8')
# locale.setlocale(locale.LC_ALL, 'ru_RU')

NOWW = datetime.NOW1()
print(NOWW)

print(NOWW.strftime('%a'))
print(NOWW.strftime('%A'))

print(f'Sana: {NOWW.strftime("%A, %d %B %y")}')
print(f'Vaqt: {NOWW.strftime("%H:%M:%S")}')

print(NOWW.strftime('%c'))
print(NOWW.strftime('%x'))
print(NOWW.strftime('%X'))

NOW = datetime.today()
print(NOW.strftime('%c'))
DD1 = NOW + timedelta(days=1, hours=2, minutes=10)
print(DD1.strftime('%c'))

XX = random.randint(1, 100)
USER_NUM = 0
CNT = 0

while True:
    USER_NUM = int(input('Sonni top: '))
    CNT += 1
    if USER_NUM == XX:
        print(f'Sonni topdingiz! Urinishlar soni {CNT} попыток')
        print("""
                ------------
                |           |
                |  0     0  |
                |     <     |
                |  .     .  |
                |   `...`   |
                ------------
                """)
        if input('Yana o`ynaymizmi? ha|yo`q:') == 'y':
            XXX = random.randint(1, 100)
            CNT = 0
        else:
            print('Tashakkur!')
            break
    elif USER_NUM > XXX:
        print('Raqm bundan kichik')
    else:
        print('Raqam bundan katta')
